<?php

class Box_model extends CI_Model
{

    public function boxList($page, $pageSize)
    {
        return $this->db->select('id,catid,thumb,title,price,nums,buy_nums')
            ->where('status', 9)
            ->limit($pageSize, ($page - 1) * $pageSize)->get('1_box')->result_array();
    }

    public function info($id, $select = "*")
    {
        return $this->db->select($select)->where('id', $id)->limit(1)->get('1_box')->row_array();
    }

    public function boxTransfer($item = [])
    {
        if ($item['thumb']) {
            $item['thumb'] = dr_thumb($item['thumb']);
        }
        if ($item['catid']) {
            $item['catid'] = dr_cat_value('box', $item['catid'], 'name');
        }
        return $item;
    }
}